package fanglog

import (
	"os"
	"log"
	"fmt"
	"time"
)

type Log struct {
	*os.File
}

func (l *Log) Panic(s interface{}){
	l.WriteString(fmt.Sprintf("%s：%s\n",time.Now().Format("2006-01-02 15:04:05"),s))
}

func InitLog(f string)Log{
	file, err := os.OpenFile(f, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
	if err != nil {
		log.Fatalln("fail to create test.log file!")
	}
	return Log{file}

}


